﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pibby.Core.IO;
using System.Drawing;

namespace Pibby.Controls
{
	public static class FileSystemImageListExtensions
	{
		public const string FolderKey = "folder";

		public static void AddIconFor(this ImageList imageList, IFolder folder)
		{
			if (!imageList.Images.ContainsKey(FileSystemImageListExtensions.FolderKey))
			{
				Icon folderIcon = IconReader.GetFolderIcon(folder.Path);
				imageList.Images.Add(FileSystemImageListExtensions.FolderKey, folderIcon);
			}
		}

		public static void AddIconFor(this ImageList imageList, IFile file)
		{
			if (imageList.Images.ContainsKey(file.Extension))
			{
				Icon fileIcon = IconReader.GetFileIcon(file.Path);
				imageList.Images.Add(file.Extension, fileIcon);
			}
		}
	}
}
